package com.yingxue.lesson.exception;

/**
 * @author chahua
 * @date 2022/4/5 13:46
 **/
public class BusinessException extends RuntimeException{
    /**
     * 异常编号
     */
    private final int code;
    /**
     * 对messageCode 异常信息进行补充说明
     */
    private final String message;

    public BusinessException(int code,String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public BusinessException(ResponseCodeInterface code) {
        this(code.getCode(), code.getMsg());
    }


    public int getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }
}

